package com.codi.bus.core.dao.impl;

import com.codi.base.dao.v2.GeneratedBaseDaoImpl;
import com.codi.bus.core.dao.FundOptionalPortfolioDao;
import com.codi.bus.core.domain.FundOptionalPortfolio;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by asus on 2017/12/6.
 */
@Repository("fundOptionalPortfolioDao")
public class FundOptionalPortfolioDaoImpl extends GeneratedBaseDaoImpl<FundOptionalPortfolio> implements FundOptionalPortfolioDao {

    @Override
    public List<FundOptionalPortfolio> selectByUserId(Long userId) {
        return this.findList(generateStatement("selectByUserId"),userId);
    }

    @Override
    public int deleteByUserIdAndCode(Long userId, String portfolioCode) {
        Map<String, Object> map = new HashMap<>();
        map.put("userId", userId);
        map.put("portfolioCode", portfolioCode);
        return this.delete(this.generateStatement("deleteByUserIdAndCode"), map);
    }
}
